import request from '@/utils/request'

// 获取商品详情
export function getProduct(id) {
  return request({
    url: `/merchant/book/${id}`,
    method: 'get'
  })
}

// 获取商品列表
export function listProduct(query) {
  return request({
    url: '/merchant/book/list',
    method: 'get',
    params: query
  })
}

// 新增商品
export function addProduct(data) {
  return request({
    url: '/merchant/book',
    method: 'post',
    data: data
  })
}

// 修改商品
export function updateProduct(data) {
  return request({
    url: '/merchant/book',
    method: 'put',
    data: data
  })
}

// 删除商品
export function delProduct(id) {
  return request({
    url: `/merchant/book/${id}`,
    method: 'delete'
  })
}

// 商品上下架
export function changeProductStatus(id, status) {
  return request({
    url: `/merchant/book/status/${id}`,
    method: 'put',
    data: { status }
  })
} 